<!DOCTYPE html>

<html lang="zh" xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org">

<head>
    <meta charset="UTF-8">
    <title th:text="'错误' + (${status} ? (' - ' + ${status}) : '')">Error</title>
    <style>
        html,
        body {
            height: 100%;
            width: 100%;
            margin: 0;
            background: linear-gradient(90deg, #2f3640 23%, #181b20 100%);
            overflow: hidden;
        }
        
        .moon {
            background: linear-gradient(90deg, #d0d0d0 48%, #919191 100%);
            position: absolute;
            top: -100px;
            left: -300px;
            width: 800px;
            height: 800px;
            content: '';
            border-radius: 100%;
            box-shadow: 0 0 30px -4px rgba(0, 0, 0, 0.5);
        }
        
        .moon-crater1 {
            top: 212px;
            left: 395px;
            width: 60px;
            height: 150px;
        }
        
        .moon-crater {
            position: absolute;
            content: '';
            border-radius: 100%;
            background: linear-gradient(90deg, #7a7a7a 38%, #c3c3c3 100%);
            opacity: 0.6;
        }
        
        .moon-crater2 {
            top: 530px;
            left: 200px;
            width: 40px;
            height: 80px;
            transform: rotate(55deg);
        }
        
        .moon-crater3 {
            top: -20px;
            left: 40px;
            width: 65px;
            height: 120px;
            transform: rotate(250deg);
        }
        
        .star {
            background: grey;
            position: absolute;
            width: 5px;
            height: 5px;
            content: '';
            border-radius: 100%;
            transform: rotate(250deg);
            opacity: 0.4;
            animation-name: shimmer;
            animation-duration: 1.5s;
            animation-iteration-count: infinite;
            animation-direction: alternate;
        }
        
        .star1 {
            top: 40%;
            left: 50%;
            animation-delay: 1s;
        }
        
        .star2 {
            top: 60%;
            left: 90%;
            animation-delay: 3s;
        }
        
        .star3 {
            top: 10%;
            left: 70%;
            animation-delay: 2s;
        }
        
        .star4 {
            top: 90%;
            left: 40%;
        }
        
        .star5 {
            top: 20%;
            left: 30%;
            animation-delay: 0.5s;
        }
        
        .error {
            position: absolute;
            left: 660px;
            top: 350px;
            transform: translateY(-60%);
            color: #fff;
        }
        
        .error-title {
            font-size: 35px;
        }
        
        .error-description {
            opacity: 0.5;
        }
        
        .error-button {
            min-width: 40px;
            margin-top: 26px;
            margin-right: 15px;
            padding: 6px 16px;
            outline: none;
            border: 2px solid #2f3640;
            background-color: transparent;
            border-radius: 20px;
            color: #fff;
            cursor: pointer;
            transition-duration: 0.2s;
            font-size: 16px;
        }
        
        .error-button-active {
            background-color: #2470bf;
            border: 2px solid #2470bf;
        }
        
        .error-button-active:hover {
            background-color: #115f96;
        }
        
        a {
            text-decoration: none;
            outline: 0;
            color: #fff;
        }
        
        .more-desc {
            display: block;
            background: white;
            color: black;
            position: relative;
            padding: 20px;
            visibility: hidden;
            margin: 40px auto;
            width: 75%;
            height: 80%;
            border-radius: 12px
        }
    </style>

</head>

<body>
    <div class="moon"></div>
    <div class="moon-crater moon-crater1"></div>
    <div class="moon-crater moon-crater2"></div>
    <div class="moon-crater moon-crater3"></div>
    <div class="star star1"></div>
    <div class="star star2"></div>
    <div class="star star3"></div>
    <div class="star star4"></div>
    <div class="star star5"></div>
    <div class="error">
        <h1 th:text="${status} + ' - ' + ${T(org.springframework.http.HttpStatus).valueOf(status).reasonPhrase}">错误报告</h1>

        <p class="error-title">
            <b>错误代码：</b> <span th:text="${error}"></span>
        </p>

        <div th:if="${errorMessage} and ${errorMessage.length() != 0}" class="error-description">
            <p><b>原因：</b> <span th:text="${errorMessage}"></span></p>
            <p><b>时间：</b> <span th:text="${{#dates.createNow()}}"></span></p>
            <p><b>请求路径：</b> <span th:text="${#request.getAttribute('javax.servlet.error.request_uri')} eq null ? ${#request.requestURI} : ${#request.getAttribute('javax.servlet.error.request_uri')}"></span></p>
        </div>
        <button class="error-button error-button-active"><a th:href="${#request.contextPath}">返回首页</a></button>
        <button class="error-button" onclick="show_more(true)" id="more">查看详情</button>
    </div>
    <div id="more-desc" class="more-desc">
        <button style="float: right" onclick="show_more(false)">X</button>
        <div style="clear: both"><h3>错误详细信息</h3></div>
        <pre style="overflow: auto; max-height: 90%" th:text="${cause}"></pre>
    </div>

    <script>
        function show_more(value) {
            document.getElementById("more-desc").style.visibility = value ? 'visible' : 'hidden'
        }
    </script>

</body>

</html>
